-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search std for module name when using with module
.
#7753
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is unfortunately another location where names get resolved that probably also needs to be updated: https://github.com/edgedb/edgedb/blob/6ba3152590fa55d9b779f790bf0ee68065080767/edb/edgeql/tracer.py#L371-L419
That operates when loading schemas, so you'll want to try write test_schema.py
tests that load schemas that have this sort of WITH module nonsense inside a computed or an alias, I guess.
tests/test_edgeql_expressions.py
Outdated
create module std::test; | ||
create function std::test::Foo(x: int64) -> int64 using(x); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a std::_test
module and a std::_test::abs
function; we can use those
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing we need to make sure works right: we run expressions through a "normalization" pass before storing them in the schema: https://github.com/edgedb/edgedb/blob/master/edb/edgeql/compiler/normalization.py
The normalization pass turns all of the names into fully qualified names. For example:
_localdev:main> create alias X := (with module math select sqrt(35));
OK: CREATE ALIAS
_localdev:main> describe schema as sdl;
{
'module default {
alias X := (
select
math::sqrt(35)
);
};',
}
We'll want to test that works too. Unfortunately I don't think we have direct normalization tests (probably a mistake), but you can test it with test_schema.py
tests that do describes.
15bedf9
to
7e1d1b5
Compare
@msullivan Not entirely sure this is what you had in mind, but I've added schema and describe tests. |
@msullivan the tracer code already did what we wanted, it was just the schema that needed updating. |
related #7737